using Microsoft.AspNetCore.Http;
using Vin.Extension.Framework.Monitor.Constants;

namespace Vin.Extension.Framework.Monitor.Extension;

public static class HttpContextExtension
{
    /// <summary>
    /// 检查是否执行请求日志
    /// </summary>
    /// <param name="context"></param>
    /// <returns></returns>
    public static bool IsExecuteRequestLog(this HttpContext context)
    {
        var value = context.Items.ContainsKey("ExecuteRequestLog");
        if (!value) context.Items.Add("ExecuteRequestLog", true);
        return value;
    }
}